﻿using System;
using System.Text.RegularExpressions;

namespace Iteration
{
    class Program
    {
        static void Main(string[] args)
        {
            //  1、用字符串分隔： 

           
 
            string str = "abcdefchij";
            string[] sArray = Regex.Split(str, "de", RegexOptions.IgnoreCase);
            foreach (string item in sArray) Console.Write(item.ToString() + "<br>");

         //   2、用多个字符来分隔：
            string str1 = "aaahbbbscccdfddeee";

            string[] sArray1 = str1.Split(new char[2] { 'h', 'f' });
            foreach (string item1 in sArray) Console.Write(item1.ToString() + "<br>");

        //3.用单个字符来分隔；
            string str2 = "aaajbbbjccc";
            string[] sArray2 = str2.Split('j');
            foreach (string item2 in sArray) Console.Write(item2.ToString() + "<br>");


            string words = "1,2.3,,4";
            string[] split = words.Split(new Char[] { ',' });
            foreach (var item4 in  split)
            {
                Console.WriteLine(item4);
            }
            string[] split1 = words.Split(new Char[] { ',', '.' });
            foreach (var item5 in split1)
            {
                Console.WriteLine(item5);
            }

             
        }
        
    }
     
       
}
